const Koa = require('koa')
const app = new Koa()
// 解决跨域问题
const cors = require('koa2-cors')

// 辅助koa理解前端传递过来的参数
const { bodyParser } = require('@koa/bodyparser')

const userRouter = require('./router/user.js')
const noteRouter = require('./router/note.js')

app.use(cors())
app.use(bodyParser())
app.use(userRouter.routes(), userRouter.allowedMethods());
app.use(noteRouter.routes(), noteRouter.allowedMethods());

app.listen(3000, () => {
    console.log('项目已在后端启动');
})